ArcPadScripting
ShapeType Example

Description

Displays the ShapeType of the selected feature's layer in a message box.

VBScript Code

Copy Code
Sub SelectedFType
   Dim objSelLayer, lngSelShapeType, strFType 
   'Get the layer of the selected feature
   Set objSelLayer = Map.SelectionLayer
   'If there is no selection, exit the Sub
   If objSelLayer Is Nothing Then 
      MsgBox "No feature has been selected.", vbInformation, "No Selection"
      Exit Sub
   End If
   'Determine the feature type
   lngSelShapeType = objSelLayer.Records.Fields.ShapeType
   Select Case lngSelShapeType
      Case 0
      strFType = "Null Shape"
      Case 1
      strFType = "Point"
      Case 3
      strFType = "PolyLine"
      Case 5
      strFType = "Polygon"
      Case 8
      strFType = "MultiPoint"      
      Case 11
      strFType = "PointZ"
      Case 13
      strFType = "PolyLineZ"
      Case 15
      strFType = "PolygonZ"
      Case 18
      strFType = "MultiPointZ"
      Case 21
      strFType = "PointM"
      Case 23
      strFType = "PolyLineM"
      Case 25
      strFType = "PolygonM"
      Case 28
      strFType = "MultiPointM"
      Case Else
      strFType = "Unknown"
   End Select
   Set objSelLayer = Nothing
   MsgBox "The selected feature is a " & strFType & ".", vbInformation, "Feature Type"
End Sub